package cn.edu.scau.dropship.ServiceImpl;

import cn.edu.scau.dropship.entity.Wish_list;
import cn.edu.scau.dropship.entity.Wish_listExample;
import cn.edu.scau.dropship.entity.Wish_list;
import cn.edu.scau.dropship.mapper.Wish_listMapper;
import cn.edu.scau.dropship.service.WishlistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WishlistServiceImpl implements WishlistService {
    @Autowired
    private Wish_listMapper wish_listMapper;

    @Override
    public long countByExample(Wish_listExample example) {
        return wish_listMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(Wish_listExample example) {
        return wish_listMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return wish_listMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Wish_list record) {
        return wish_listMapper.insert(record);
    }

    @Override
    public int insertSelective(Wish_list record) {
        return wish_listMapper.insertSelective(record);
    }

    @Override
    public List<Wish_list> selectByExample(Wish_listExample example) {
        return wish_listMapper.selectByExample(example);
    }

    @Override
    public Wish_list selectByPrimaryKey(Integer id) {
        return wish_listMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByExampleSelective(Wish_list record, Wish_listExample example) {
        return wish_listMapper.updateByExampleSelective(record, example);
    }

    @Override
    public int updateByExample(Wish_list record, Wish_listExample example) {
        return wish_listMapper.updateByExample(record, example);
    }

    @Override
    public int updateByPrimaryKeySelective(Wish_list record) {
        return wish_listMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Wish_list record) {
        return wish_listMapper.updateByPrimaryKey(record);
    }

    @Override
    public Wish_list selectByUid(Integer uid) {
        Wish_listExample wish_listExample=new Wish_listExample();
        Wish_listExample.Criteria criteria=wish_listExample.createCriteria();
        criteria.andBvoIdEqualTo(uid);
        List<Wish_list> list=wish_listMapper.selectByExample(wish_listExample);
        if(list.size()>0){
            return list.get(0);
        }
        return null;
    }
}
